<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>转账业务</title>
<style type="text/css">
	#yjc {
		width: 400px;
		height: 240px;
		margin: 0px;
		padding: 30px 0;
	}
	#xpz{
		margin-top: 80px;
	}
	body{
		background-color:#FFF5EE;
	}
</style>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
var flag=true;
function checkYhm1(str){
	$.post('checkYhm1?yhm='+str,function(data){
		$('#userErr').html(data);
		var str=data+"";
		if(str.indexOf("姓名：")!=-1){
			flag=true;
		}else{
			flag=false;
		}
	},'html');
}

function yanz(){
	var a = document.forms["myForm"]["money"].value;
	var b = document.forms["myForm"]["yhm"].value;
	if(!flag){
		alert("该账户不存在！");
		return false;
	}else if(a==""||a==null||b==""||b==null){
		alert("未输入转账金额或未输入对方卡号！");
		return false;
	}else if(a>50000){
		alert("单笔转账不能超过50000！");
		return false;
	}else if(!(/^[0-9][0-9]*$/.test(a))){
		alert("转账金额输入非法，请重新输入！");
		return false;
	}else if(a%50!=0){
		alert("转账金额必须为50的倍数！");
	    return false;
	}else if((${zhanghu.money})<a){
		alert("账户余额不足，无法完成转账！")
		return false;
	}else{
		alert("转账成功！")
		return true;
	}
}
</script>
</head>
<body>
<center>
<div id="xpz">
	<img alt="" src="beijing/logo.jpg" width="650px" height="180px">
</div>
<div id="yjc">
	<form action="Zhuangzhang?qwe=${zhanghu.yhm}" name="myForm" method="post" onsubmit="return yanz();">
	<h1 style="color:#000000">转账业务</h1>
		<table>
			<tbody>
				<tr>
					<td>请输入收款账户：</td>
				</tr>
				<tr>
					<td>
						<input type="text" name="yhm" onchange="checkYhm1(this.value);">
						<br/>
						<font color="red" id="userErr"></font>
					</td>
				</tr>
				<tr>
					<td>请输入转账金额：</td>
				</tr>
				<tr>
					<td>
						<input type="text" name="money"> 
					</td>
				</tr>
				<tr></tr><tr></tr><tr></tr>
				<tr>
					<td>
						<input type="submit" value="提交">&emsp;
						<input type="reset" value="重置">&emsp;
						<input type="button" value="返回" onclick="window.location='yhwelcome.jsp'">
					</td>				
				</tr>
			</tbody>
		</table>
	</form>
</div>
</center>
</body>
</html>